package org.whh.org.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import org.whh.base.service.impl.BaseServiceImpl;
import org.whh.dto.result.RoleDTO;
import org.whh.org.domain.Employee;
import org.whh.org.mapper.EmployeeMapper;
import org.whh.org.service.IEmployeeService;

import java.util.List;
@Service
@Transactional(readOnly = true,propagation = Propagation.SUPPORTS)
public class EmployeeServiceImpl extends BaseServiceImpl<Employee> implements IEmployeeService {
    @Autowired
    EmployeeMapper employeeMapper;
    @Override
    public void setEmployeeRole(RoleDTO dto) {
        employeeMapper.deleteEmployeeRoleByEmployeeId(dto.getEmployeeId());

        employeeMapper.saveEmployeeRole(dto.getEmployeeId(),dto.getRoleId());
    }

    @Override
    public List<Long> getRoleIdByEmployeeId(Long employeeId) {
        return employeeMapper.getRoleIdByEmployeeId(employeeId);
    }
}
